import java.util.*;

public class Main4 {
    public static void main(String[] args)
    {
        Scanner cin = new Scanner(System.in);
        int n = cin.nextInt();

        int arr1[] = new int[n];
        int arr2[] = new int[n];
        int pos = 1,n1=0,n2=0;

        for(int i =0;i<n;i++)
        {
            if(pos%2==1)
                arr1[n1++] = cin.nextInt();
            else
                arr2[n2++] = cin.nextInt();
            pos++;
        }

        for(int i =0;i<n1;i++)
        {
            if(i!=n1-1)
                System.out.print(arr1[i]+" ");
            else
                System.out.print(arr1[i]+"\n");
        }

        for(int i =0;i<n2;i++)
        {
            if(i!=n2-1)
                System.out.print(arr2[i]+" ");
            else
                System.out.print(arr2[i]);
        }

        cin.close();
    }
}
